#include "articletextedit.h"

#include <QKeyEvent>


ArticleTextEdit::ArticleTextEdit(QWidget *parent)
    : QTextEdit(parent)
{

}

ArticleTextEdit::ArticleTextEdit(const QString &text, QWidget *parent)
    : QTextEdit(text, parent)
{

}

ArticleTextEdit::~ArticleTextEdit()
{

}

void ArticleTextEdit::keyPressEvent(QKeyEvent *event)
{
    if (event->key() == Qt::Key_Tab && event->modifiers() == Qt::NoModifier) {
        insertPlainText(QString(4, ' '));  // 生成4个空格
        return;
    }
    QTextEdit::keyPressEvent(event);  // 操，必须调用父类处理其他按键
}
